package com.ibeetl.admin.core.service;

import com.ibeetl.admin.core.dao.CoreGlInterfaceDao;
import com.ibeetl.admin.core.entity.CoreGlInterface;
import com.ibeetl.admin.core.entity.CoreSearch;
import com.ibeetl.admin.core.entity.mcoreGlInterface;
import com.ibeetl.admin.core.util.JDBCUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Service
@Transactional
public class CoreGlInterfaceService {
	@Autowired
    CoreGlInterfaceDao coreGlInterfaceDAO;

	public List<CoreGlInterface> queryData(String sql) {
		JdbcTemplate template = new JdbcTemplate(JDBCUtils.getDataSource());
		List<CoreGlInterface> coreGlInterfaces = template.query(sql,new Object[]{},new BeanPropertyRowMapper<CoreGlInterface>(CoreGlInterface.class));
		return coreGlInterfaces;
	}

	public void saveCoreGlInterFace(CoreGlInterface coreGlInterFace) {
		coreGlInterfaceDAO.insert(coreGlInterFace);
	}

	public void deleteFromCoreGlInterface(CoreSearch search) {
		coreGlInterfaceDAO.deleteFromCoreGlInterface(search);
	}

	public List<CoreGlInterface> getCoreGlInterfaceDatasOfMoney(CoreSearch search) {
		return coreGlInterfaceDAO.getCoreGlInterfaceDatasOfMoney(search);
	}

	public List<CoreGlInterface> getCoreGlInterfaceDatasOfItem(CoreSearch search) {
		return coreGlInterfaceDAO.getCoreGlInterfaceDatasOfItem(search);
	}

	public List<mcoreGlInterface> queryItemData(String sql) {
		return coreGlInterfaceDAO.queryItemData(sql);
	}

}
